/*
 * ViewerProtocol.h
 *
 *  Created on: May 25, 2011
 *      Author: madboyka
 */

#ifndef VIEWERPROTOCOL_H_
#define VIEWERPROTOCOL_H_

#include "NetworkException.h"
#include "ElementData.h"
#include <QString>

class ViewerProtocol {
public:
        /*!
          Static constants for the protocol
        */
	static const int ADD_ELEMENTS = 1;
	static const int DELETE_ELEMENTS = 2;
	static const int CHANGE_ELEMENTS = 3;
	static const int PORT = 1337;
	ViewerProtocol() {
	}
	;

	virtual int receive() = 0;

        /*!
          Connects to the server
          @param[in] QString server ip
        */
	virtual void connect(QString) = 0;

        /*!
          Closing the socket
        */
	virtual void close() = 0;

        /*!
           Initializing the server
        */
	virtual void bind() = 0;

        /*!
           The viewer retrieves the transformation matrix sent by the server
           @return returns a trasnformation matrix
        */
	virtual float* getLocationData() = 0;

        /*!
          Receiving connections
          @return an instance of a connection
        */
	virtual ViewerProtocol* acceptConnection() = 0;

        /*!
          The client sending message to the server
          @param[in] message type
        */
	virtual void sendMessage(int,int) = 0;

        /*!
          Sending data
          @param[in] data to send
        */
	virtual void sendObjects(const void*, int) = 0;

        /*!
          Waiting for request from the client
        */
	virtual void waitRequest() = 0;

        /*!
          Sending request to the server
        */
	virtual void sendRequest() = 0;

        /*!
          @return
        */
	virtual int getCount() = 0;

        /*!
          @return an elementData class
        */
	virtual ElementData getNewElement(int) = 0;

        /*!
          sends elementData class
        */
	virtual void writeElementData(const ElementData) = 0;

        /*!
          retrieves an elementData class
        */
	virtual ElementData readElementData() = 0;
};

#endif /* VIEWERPROTOCOL_H_ */
